import { type DefaultTheme } from 'vitepress'
//import sidebarGuide from './sidebarGuide'
import sidebarOther from './sidebarOther'

const transNav = (base: string, arrFn: () => DefaultTheme.SidebarItem[]) => {
  const nav = arrFn().map(i => {
    const link = i.items![0].link
    return { text: i!.text || '', link: `${base}${link}` }
  })
  return nav
}
// TODO 需要自己生成
const sidebar = {
  //'/guide/': { base: '/guide/', items: sidebarGuide() },
  '/other/': { base: '/other/', items: sidebarOther() }
}
const nav: DefaultTheme.NavItem[] = [
  { text: '开始阅读', items: transNav('/other/', sidebarOther) },
  { text: '其他', items: transNav('/other/', sidebarOther) }
]

export { sidebar, nav }
